package previous.Test_0330;

import java.util.*;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 */
public class Bridge_Blue {
    //山
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int count=0;
        for (int i = 2022; i <=2022222022; i++) {
            if(isShang(i))
                count++;
        }
        System.out.println(count);
        System.out.println(3138);
        scan.close();
    }
    public static boolean isShang(int num){
        String s=String.valueOf(num);
        int n=s.length();
        int mid=n/2;
        //判断前半部分单调递增
        for (int i = 1; i <mid ; i++) {
            if(s.charAt(i-1)>s.charAt(i))
                return false;
        }
        //判断单调递减
        for (int i =mid+1 ; i <n; i++) {
            if(s.charAt(i-1)<s.charAt(i))
                return false;
        }
        //判断回文串
        for (int i = 0; i < n; i++) {
            if(s.charAt(i)!=s.charAt(n-i-1))
                return false;
        }
        return true;
    }



}
